/*
 * Germinus
 */
package org.germinus.telcoblocks.servicios.diagram.rcp.edit.policies;

import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.commands.Command;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
import org.germinus.telcoblocks.TelcoblocksPackage;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.AnunciosCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.ClickToDialCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.DesvioCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.FacturacionCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.IMCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.LlamadasCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.PersonalizacionCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.ServicioGenCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.TelefonoCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.edit.commands.WebCreateCommand;
import org.germinus.telcoblocks.servicios.diagram.rcp.providers.TelcoblocksElementTypes;

/**
 * @generated
 */
public class SERVICIOSItemSemanticEditPolicy extends
		TelcoblocksBaseItemSemanticEditPolicy {

	/**
	 * @generated
	 */
	protected Command getCreateCommand(CreateElementRequest req) {
		if (TelcoblocksElementTypes.ClickToDial_2001 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new ClickToDialCreateCommand(req));
		}
		if (TelcoblocksElementTypes.Llamadas_2002 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new LlamadasCreateCommand(req));
		}
		if (TelcoblocksElementTypes.ServicioGen_2003 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new ServicioGenCreateCommand(req));
		}
		if (TelcoblocksElementTypes.Personalizacion_2004 == req
				.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new PersonalizacionCreateCommand(req));
		}
		if (TelcoblocksElementTypes.IM_2005 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new IMCreateCommand(req));
		}
		if (TelcoblocksElementTypes.Facturacion_2006 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new FacturacionCreateCommand(req));
		}
		if (TelcoblocksElementTypes.Web_2007 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new WebCreateCommand(req));
		}
		if (TelcoblocksElementTypes.Desvio_2008 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new DesvioCreateCommand(req));
		}
		if (TelcoblocksElementTypes.Anuncios_2009 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new AnunciosCreateCommand(req));
		}
		if (TelcoblocksElementTypes.Telefono_2010 == req.getElementType()) {
			if (req.getContainmentFeature() == null) {
				req.setContainmentFeature(TelcoblocksPackage.eINSTANCE
						.getSERVICIOS_Nodos());
			}
			return getGEFWrapper(new TelefonoCreateCommand(req));
		}
		return super.getCreateCommand(req);
	}

	/**
	 * @generated
	 */
	protected Command getDuplicateCommand(DuplicateElementsRequest req) {
		TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost())
				.getEditingDomain();
		return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
	}

	/**
	 * @generated
	 */
	private static class DuplicateAnythingCommand extends
			DuplicateEObjectsCommand {

		/**
		 * @generated
		 */
		public DuplicateAnythingCommand(
				TransactionalEditingDomain editingDomain,
				DuplicateElementsRequest req) {
			super(editingDomain, req.getLabel(), req
					.getElementsToBeDuplicated(), req
					.getAllDuplicatedElementsMap());
		}

	}

}
